package org.example.weather.storage;

import org.example.weather.core.WeatherData;
import org.example.weather.core.WeatherService;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class WeatherServiceImpl implements WeatherService {
    private List<WeatherData> weatherDataList=new ArrayList<>();
    @Override
    public void recordWeatherData(WeatherData weatherData) {
        weatherDataList.add(weatherData);
    }
    @Override
    public List<WeatherData> getWeatherDataByLocation(String location) {
        return weatherDataList.stream()
                .filter(data -> data.getLocation().equalsIgnoreCase(location))
                .collect(Collectors.toList());
    }
}
